package com.cyq.stock.server;

import com.cyq.stock.mapper.StockMapper;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class StockServiceImpl implements StockService {

    @Autowired
    private StockMapper stockMapper;

    @Override
    public int reduct(Integer productId) {
        System.out.println("更新商品:"+productId);
        log.info("Seata全局事务ID：{}", RootContext.getXID());

        return stockMapper.reduct(productId);
    }

}
